/*
 * 
 * author     date                    function                 purpose
 * wuwentao   20111122             base structure               */


package com.badlogicgames.framwork;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;

public abstract class Game implements ApplicationListener {
	Screen screen;

	public void setScreen (Screen otherScreen) {//when we need to change the scene, call this function
		screen.pause();
		screen.dispose();
		screen = otherScreen;
	}

	public abstract Screen getStartScreen ();

	@Override
	public void create () {
		screen = getStartScreen();//start the whole game
	}

	@Override
	public void resume () {
		screen.resume();
	}

	@Override
	public void render () {// render the game every certain time
		screen.update(Gdx.graphics.getDeltaTime());
		screen.present(Gdx.graphics.getDeltaTime());
	}

	@Override
	public void resize (int width, int height) {//when change the size of the game screen. Seldom be called

	}

	@Override
	public void pause () {//pause the game
		screen.pause();
	}

	@Override
	public void dispose () {// destroy the game
		screen.dispose();
	}
}
